using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using UKVSTS;

namespace IEeee
{
    public class SnapShotSection
    {

        private String m_Title;

        private List<NamedWrapper<String>> m_Attributes = new List<NamedWrapper<String>> ();

        public SnapShotSection (String title)
        {
            ArgTest.IsNotNullOrEmpty (title, "title");
            m_Title = title;
        }

        public String Title
        {
            get { return m_Title; }
        }

        public void AddAttribute (String name, String value)
        {
            ArgTest.IsNotNullOrEmpty (name, "name");
            ArgCorrect.EmptyStringIfNull (ref value);

            m_Attributes.Add (new NamedWrapper<string> (value, name));
        }

        public void AddAttribute (String name, int value)
        {
            ArgTest.IsNotNullOrEmpty (name, "name");

            m_Attributes.Add (new NamedWrapper<string> (value.ToString (), name));
        }

        public void AddAttribute (String name, bool value)
        {
            ArgTest.IsNotNullOrEmpty (name, "name");

            m_Attributes.Add (new NamedWrapper<string> (value.ToString (), name));
        }

        public override string ToString ()
        {
            StringBuilder buf = new StringBuilder ();

            buf.Append (Title);
            buf.Append ("\n");
            buf.Append ('-', Title.Length);


            foreach (NamedWrapper<string> attr in m_Attributes)
            {
                buf.Append ("\n  ");
                buf.Append (attr.Name);
                buf.Append (" : ");
                buf.Append (attr.Item);
            }

            return buf.ToString ();
        }
    }
}
